<!-- 留言评论模块 -->
<template>
  <div class="tmsgBox" ref="tmsgBox">
    <div class="tmsg-respond" ref="respondBox">
      <h3>
        发表评论
        <small v-show="isRespond" class="tcolorm" @click="removeRespond"
          >取消回复</small
        >
      </h3>
      <form class="">
        <el-input
          type="textarea"
          :rows="2"
          placeholder="说点什么呢``"
          v-model="textarea"
        >
        </el-input>
        <el-row class="tmsg-r-info">
          <el-col :span="24" class="info-submit">
            <p class="tcolors-bg" @click="sendMsg">{{ sendTip }}</p>
          </el-col>
        </el-row>
      </form>
    </div>
    <div class="tmsg-comments" ref="listDom">
      <a href="#" class="tmsg-comments-tip"
        >全部评论 {{ commentList ? commentList.length : 0 }} 条</a
      >
      <div class="tmsg-commentshow">
        <!-- 主评论 -->
        <ul class="tmsg-commentlist">
          <li
            class="tmsg-c-item"
            v-for="(item, index) in commentList"
            :key="'common' + index"
          >
            <article class="">
              <header>
                <el-dropdown placement="top">
                  <img :src="item.avatar" :onerror="$store.state.errorImg" />

                  <el-dropdown-menu
                    slot="dropdown"
                    style="width: 250px; height: 120px"
                  >
                    <div class="Personaldata">
                      <div class="personaldataimage">
                        <img
                          :src="item.avatar"
                          :onerror="$store.state.errorImg"
                          style="width: 55px; height: 55px; border-radius: 50%"
                        />
                      </div>
                      <div class="personaldata">
                        <div class="personone">
                          <span
                            style="
                              font-size: 1.2rem;
                              font-weight: bold;
                              color: #007bff;
                            "
                          >
                            {{ item.username }}
                          </span>
                          <svg
                            class="icon huiyuan"
                            aria-hidden="true"
                            v-if="item.sex === '0'"
                            style="width: 18px; height: 18px"
                          >
                            <use :xlink:href="'#icon-nan'"></use>
                          </svg>
                          <svg
                            class="icon huiyuan"
                            aria-hidden="true"
                            v-else-if="item.sex === '1'"
                            style="width: 18px; height: 18px"
                          >
                            <use :xlink:href="'#icon-nv'"></use>
                          </svg>
                        </div>

                        <div class="personuid">
                          <span style="font-size: 1.1rem; color: #606266"
                            ><p class="uid">UID</p>
                            {{ item.userUuid }}</span
                          >
                        </div>

                        <div class="personvip">
                          <p
                            class="i-name userSvip"
                            v-bind:class="{
                              normal: getSvipText(item.userSvip) === '普通用户',
                              vip: getSvipText(item.userSvip) === 'vip普通会员',
                              'super-vip':
                                getSvipText(item.userSvip) === 'Svip超级会员',
                              'annual-vip':
                                getSvipText(item.userSvip) === 'vip年费会员',
                              'annual-super-vip':
                                getSvipText(item.userSvip) ===
                                'Svip年费超级会员',
                            }"
                          >
                            <svg class="icon huiyuan" aria-hidden="true">
                              <use xlink:href="#icon-huiyuan"></use>
                            </svg>
                            {{ getSvipText(item.userSvip) }}
                          </p>
                        </div>
                        <div class="personRegisterDay">
                          <p
                            style="
                              color: #606266;
                              font-weight: bold;
                              font-size: 1rem;
                            "
                          >
                            已注册{{ calculateDays(item.registerTime) }}天
                          </p>
                        </div>
                      </div>
                    </div>
                  </el-dropdown-menu>
                </el-dropdown>
                <div class="i-name">
                  {{ item.username }}
                </div>
                <div v-if="item.userone" class="i-name m-class">
                  {{ item.userone }}
                </div>
                <div class="i-name userVip">
                  <svg class="icon huiyuan" aria-hidden="true">
                    <use xlink:href="#icon-dengjizhongxin"></use></svg
                  >Lv.{{ item.userVip }}
                </div>
                <div
                  class="i-name userSvip"
                  v-bind:class="{
                    normal: getSvipText(item.userSvip) === '普通用户',
                    vip: getSvipText(item.userSvip) === 'vip普通会员',
                    'super-vip': getSvipText(item.userSvip) === 'Svip超级会员',
                    'annual-vip': getSvipText(item.userSvip) === 'vip年费会员',
                    'annual-super-vip':
                      getSvipText(item.userSvip) === 'Svip年费超级会员',
                  }"
                >
                  <svg class="icon huiyuan" aria-hidden="true">
                    <use xlink:href="#icon-huiyuan"></use>
                  </svg>
                  {{ getSvipText(item.userSvip) }}
                </div>

                <div class="i-time">
                  <time>{{ item.createTime }}</time>
                </div>
              </header>
              <section>
                <p v-html="item.content">
                  {{ item.content }}
                </p>

                <br />
                <span
                  v-if="haslogin"
                  class="tmsg-replay tmsg-reply-btn"
                  @click="respondMsg(item.id, item.id, item.createBy)"
                >
                  回复
                </span>

                <span
                  v-if="haslogin && item.createBy === currentUser"
                  class="tmsg-replay tmsg-delete-btn"
                  @click="deleteMsg(item.id)"
                >
                  删除
                </span>
              </section>
              <!-- 删除评论的确认对话框 -->
              <el-dialog
                :visible.sync="deleteDialogVisible"
                title="确认删除评论？"
              >
                <p>是否确定删除这条评论？</p>
                <span slot="footer" class="dialog-footer">
                  <el-button @click="deleteComment">确定</el-button>
                  <el-button @click="cancelDelete">取消</el-button>
                </span>
              </el-dialog>
            </article>
            <!--2级 子评论 -->
            <ul
              v-if="item.children && item.children.length > 0"
              class="tmsg-commentlist-children"
              style="padding-left: 60px"
            >
              <li
                class="tmsg-c-item"
                v-for="(citem, cindex) in item.children"
                :key="'citem' + cindex"
              >
                <article class="">
                  <header>
                    <el-dropdown placement="top">
                      <img
                        :src="citem.avatar"
                        :onerror="$store.state.errorImg"
                      />

                      <el-dropdown-menu
                        slot="dropdown"
                        style="width: 250px; height: 120px"
                      >
                        <div class="Personaldata">
                          <div class="personaldataimage">
                            <img
                              :src="citem.avatar"
                              :onerror="$store.state.errorImg"
                              style="
                                width: 55px;
                                height: 55px;
                                border-radius: 50%;
                              "
                            />
                          </div>
                          <div class="personaldata">
                            <div class="personone">
                              <span
                                style="
                                  font-size: 1.2rem;
                                  font-weight: bold;
                                  color: #007bff;
                                "
                              >
                                {{ citem.username }}
                              </span>
                              <svg
                                class="icon huiyuan"
                                aria-hidden="true"
                                v-if="citem.sex === '0'"
                                style="width: 18px; height: 18px"
                              >
                                <use :xlink:href="'#icon-nan'"></use>
                              </svg>
                              <svg
                                class="icon huiyuan"
                                aria-hidden="true"
                                v-else-if="citem.sex === '1'"
                                style="width: 18px; height: 18px"
                              >
                                <use :xlink:href="'#icon-nv'"></use>
                              </svg>
                            </div>

                            <div class="personuid">
                              <span style="font-size: 1.1rem; color: #606266"
                                ><p class="uid">UID</p>
                                {{ citem.userUuid }}</span
                              >
                            </div>

                            <div class="personvip">
                              <p
                                class="i-name userSvip"
                                v-bind:class="{
                                  normal:
                                    getSvipText(citem.userSvip) === '普通用户',
                                  vip:
                                    getSvipText(citem.userSvip) ===
                                    'vip普通会员',
                                  'super-vip':
                                    getSvipText(citem.userSvip) ===
                                    'Svip超级会员',
                                  'annual-vip':
                                    getSvipText(citem.userSvip) ===
                                    'vip年费会员',
                                  'annual-super-vip':
                                    getSvipText(citem.userSvip) ===
                                    'Svip年费超级会员',
                                }"
                              >
                                <svg class="icon huiyuan" aria-hidden="true">
                                  <use xlink:href="#icon-huiyuan"></use>
                                </svg>
                                {{ getSvipText(citem.userSvip) }}
                              </p>
                            </div>
                            <div class="personRegisterDay">
                              <p
                                style="
                                  color: #606266;
                                  font-weight: bold;
                                  font-size: 1rem;
                                "
                              >
                                已注册{{ calculateDays(citem.registerTime) }}天
                              </p>
                            </div>
                          </div>
                        </div>
                      </el-dropdown-menu>
                    </el-dropdown>
                    <div class="i-name">
                      {{ citem.username }}
                      <div v-if="citem.userone" class="i-name m-class">
                        {{ citem.userone }}
                      </div>
                      <div class="i-name userVip">
                        <svg class="icon huiyuan" aria-hidden="true">
                          <use xlink:href="#icon-dengjizhongxin"></use></svg
                        >Lv.{{ citem.userVip }}
                      </div>
                      <div
                        class="i-name userSvip"
                        v-bind:class="{
                          normal: getSvipText(citem.userSvip) === '普通用户',
                          vip: getSvipText(citem.userSvip) === 'vip普通会员',
                          'super-vip':
                            getSvipText(citem.userSvip) === 'Svip超级会员',
                          'annual-vip':
                            getSvipText(citem.userSvip) === 'vip年费会员',
                          'annual-super-vip':
                            getSvipText(citem.userSvip) === 'Svip年费超级会员',
                        }"
                      >
                        <svg class="icon huiyuan" aria-hidden="true">
                          <use xlink:href="#icon-huiyuan"></use>
                        </svg>
                        {{ getSvipText(citem.userSvip) }}
                      </div>
                    </div>

                    <div class="i-time">
                      <time>{{ citem.createTime }}</time>
                    </div>
                  </header>
                  <section>
                    <p v-html="citem.content">
                      {{ citem.content }}
                    </p>
                    <br />

                    <span
                      v-if="haslogin && citem.createBy === currentUser"
                      class="tmsg-replay tmsg-delete-btn"
                      @click="deleteMsg(citem.id)"
                    >
                      删除
                    </span>
                  </section>
                </article>
                <!-- 如果存在3子评论，则显示子评论 -->
              </li>
            </ul>
          </li>
        </ul>

        <h1 v-show="hasMore" class="tcolors-bg" @click="addMoreFun">
          查看更多
        </h1>
        <h1 v-show="!hasMore" class="tcolors-bg">没有更多</h1>
      </div>
    </div>
  </div>
</template>

<script>
import {
  sendComment,
  getArticleComment,
  getLinkComment,
  getWord,
  getfriendsComment,
  deletemessage,
  getRegister,
} from "../api/comment.js";

import { getToken } from "../utils/auth.js";

export default {
  components: {},
  data() {
    //选项 / 数据
    return {
      
      deleteDialogVisible: false, // 是否显示删除确认对话框
      dirtyList: [],
      item: {},
      currentUser: null, // 初始化为 null 或者其他默认值
      sensitiveWords: [], // 添加敏感词列表属性
      trieRoot: {}, // 添加 Trie 树根节点属性

      respondBox: "", //评论表单
      listDom: "", //评论列表
      tmsgBox: "", //总评论盒子
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        articleId: 0,
      },

      isRespond: false,
      textarea: "", //文本框输入内容

      pBody: true, //表情打开控制
      commentList: [], //评论列表数据
      aid: 0, //文章id
      hasMore: false,
      haslogin: false,
      userId: "", //用户id
      type: 0, //回复评论的当前的commentId
      leavePid: "", //赞赏等其他模块的分类id
      pid: "", //回复评论的一级commentId
      rootId: -1, //根评论id，如果是针对文字评论直接用-1表示
      toCommentId: -1, //所回复评论的id
      toCommentUserId: -1, //所评论的用户id
      sendTip: "发送~",
    };
  },
  methods: {
    calculateDays(registerTime) {
      const today = new Date(); // 获取当前日期
      const registerDate = new Date(registerTime); // 将注册日期字符串转换为 Date 对象

      // 计算两个日期之间的时间差（毫秒）
      const timeDiff = today.getTime() - registerDate.getTime();

      // 将时间差转换为天数，并向下取整
      const days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));

      return days; // 返回计算结果
    },
    getSvipText(userSvip) {
      switch (userSvip) {
        case "0":
          return "普通用户";
        case "1":
          return "vip普通会员";
        case "2":
          return "Svip超级会员";
        case "3":
          return "vip年费会员";
        case "4":
          return "Svip年费超级会员";
        default:
          return "未知";
      }
    },
    buildTrie(dirtyList) {
      // 构建 Trie 树
      this.trieRoot = {};
      for (var i = 0; i < dirtyList.length; i++) {
        var word = dirtyList[i];
        var node = this.trieRoot;
        for (var j = 0; j < word.length; j++) {
          var ch = word[j];
          if (!node[ch]) {
            node[ch] = {};
          }
          node = node[ch];
        }
        node.isEnd = true;
      }
    },
    filterDirtyWords(textarea) {
      return this.matchDirtyWords(textarea, this.trieRoot);
    },
    matchDirtyWords(textarea, node) {
      if (!textarea || !node) {
        return textarea;
      }
      var ch = textarea[0];
      var rest = textarea.substring(1);
      var nextNode = node[ch];
      if (nextNode) {
        if (nextNode.isEnd) {
          return (
            "***".repeat(textarea.length - rest.length) +
            this.matchDirtyWords(rest, this.trieRoot)
          );
        } else {
          return ch + this.matchDirtyWords(rest, nextNode);
        }
      } else {
        return ch + this.matchDirtyWords(rest, this.trieRoot);
      }
    },

    //事件处理器
    setData(initData, result) {
      var msg = result.rows;
      if (initData) {
        //刷新列表
        this.commentList = msg;
      } else {
        //加载更多
        this.commentList = this.commentList.concat(msg);
      }

      this.hasMore = result.total > this.commentList.length;
    },
    //选择表情包

    //发送留言
    sendMsg: function () {
      //留言
      var that = this;
      var tokenInfo = getToken();

      if (!tokenInfo || Date.now() > tokenInfo.expirationTime) {
        that
          .$confirm(
            "登录状态已过期或者未登录，您需要重新登录后才能评论，是否前往登录页面?",
            "提示",
            {
              confirmButtonText: "确定前往",
              cancelButtonText: "取消",
              type: "warning",
            }
          )
          .then(() => {
            //确定，跳转至登录页面
            //储存当前页面路径，登录成功后跳回来
            localStorage.setItem("logUrl", that.$route.fullPath);
            that.$router.push({ path: "/About" });
          })
          .catch(() => {});
        return;
      }

      //将过滤好的内容在发给后端
      var filteredText = that.filterDirtyWords(that.textarea);
      if (that.textarea) {
        that.sendTip = "咻~~";
        sendComment(
          that.type,
          that.aid,
          that.rootId,
          that.toCommentId,
          that.toCommentUserId,
          filteredText
        ).then((response) => {
          that.textarea = "";
          that.rootId = -1;
          that.toCommentId = -1;
          that.toCommentUserId = -1;

          that.routeChange();
          that.removeRespond();
          var timer02 = setTimeout(function () {
            that.sendTip = "发送~";
            clearTimeout(timer02);
          }, 1000);
        });
      } else {
        that.sendTip = "内容不能为空~";
        var timer = setTimeout(function () {
          that.sendTip = "发送~";
          clearTimeout(timer);
        }, 3000);
      }
    },
    respondMsg: function (rootId, toCommentId, toCommentUserId) {
      //回复留言
      // console.log(leavePid,pid);
      var that = this;
      if (localStorage.getItem("userInfo")) {
        var dom = event.currentTarget;
        dom = dom.parentNode;
        this.isRespond = true;
        //   this.leavePid = leavePid;
        this.rootId = rootId;
        this.toCommentId = toCommentId;
        this.toCommentUserId = toCommentUserId;
        dom.appendChild(this.$refs.respondBox);
      } else {
        that
          .$confirm("登录后即可点赞和收藏，是否前往登录页面?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          })
          .then(() => {
            //确定，跳转至登录页面
            //储存当前页面路径，登录成功后跳回来
            localStorage.setItem("logUrl", that.$route.fullPath);
            that.$router.push({ path: "/About" });
          })
          .catch(() => {});
      }
    },
    removeRespond: function () {
      //取消回复留言
      this.isRespond = false;
      this.rootId = -1;
      this.toCommentId = -1;
      this.toCommentUserId = -1;
      this.$refs.tmsgBox.insertBefore(
        this.$refs.respondBox,
        this.$refs.listDom
      );
    },
    showCommentList: function (initData) {
      //评论列表
      var that = this;
      that.aid =
        that.$route.query.aid == undefined
          ? 1
          : parseInt(that.$route.query.aid); //获取传参的aid
      that.queryParams.articleId = that.aid;
      //判断当前用户是否登录
      var token = getToken();
      if (token) {
        that.haslogin = true;
      } else {
        that.haslogin = false;
      }

      //公用设置数据方法

      if (that.$route.name == "DetailArticle") {
        //文章列表的评论
        that.type = 0;
        getArticleComment(that.queryParams).then((response) => {
          that.setData(initData, response);
        });
        const userInfo = JSON.parse(localStorage.getItem("userInfo"));
        // const id = userInfo.id;
        // this.currentUser = id;
      } else {
        //其他评论
        if (that.$route.name == "FriendsLink") {
          that.type = 1;
          getLinkComment(that.queryParams).then((response) => {
            that.someProperty = response; // 将response赋值给某个属性
            that.setData(initData, response);
            // console.log(that.someProperty);
          });
          //console.log(localStorage.getItem("userInfo"));
          const userInfo = JSON.parse(localStorage.getItem("userInfo"));
          if (userInfo && userInfo.id) {
            const id = userInfo.id;
            this.currentUser = id;
          } else {
            // 处理未找到 id 的情况
          }
        } else if (that.$route.name == "Reward") {
          that.type = 1;
          getfriendsComment(that.queryParams).then((response) => {
            that.setData(initData, response);
          });
          const userInfo = JSON.parse(localStorage.getItem("userInfo"));
          if (userInfo && userInfo.id) {
            const id = userInfo.id;
            this.currentUser = id;
          } else {
            // 处理未找到 id 的情况
          }
        }
      }
    },
    addMoreFun: function () {
      //查看更多
      this.queryParams.pageNum++;
      this.showCommentList(false);
    },
    routeChange: function () {
      //重新加载
      var that = this;
      this.queryParams.pageNum = 1;
      this.showCommentList(true);
    },

    //删除评论
    deleteMsg(commentId) {
      // 点击删除按钮时显示确认对话框
      //this.deleteComment(commentId);
      this.selectedCommentId = commentId;
      this.deleteDialogVisible = true;
    },
    deleteComment() {
      // 在这里执行删除评论的逻辑 获取当前的评论id
      const commentId = this.selectedCommentId;
      deletemessage(commentId).then((response) => {
        // 删除成功后，关闭确认对话框并弹出删除成功的消息
        this.deleteDialogVisible = false;
        this.$message.success("评论已删除");
        setTimeout(() => {
          location.reload(); // 或者使用 this.$router.push({ path: '/' }) 来跳转到当前页面
        }, 1000);
      });
    },
    cancelDelete() {
      // 取消删除，关闭确认对话框
      this.deleteDialogVisible = false;
    },
  },

  watch: {
    // 如果路由有变化，会再次执行该方法
    // '$route':'routeChange'
  },
  created() {
    //生命周期函数
    // console.log(this.$route);
    var that = this;
    that.routeChange();
  },
  mounted() {
    getWord().then((res) => {
      //console.log(res.dirtyList)
      this.buildTrie(res.dirtyList);
    });
  },
};
</script>

<style scoped>
.uid {
  font-weight: bold; /* 设置字体粗细 */
  color: #333; /* 设置字体颜色 */
  /* 其他样式可以根据需要添加 */
  font-size: 10px;
  width: 28px;
  height: 15px;
  line-height: 16px;
  border-radius: 4px;
  display: inline-block;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  text-align: center;
  color: #fff;
  background: #c0c4cc;
  height: 18px;
  line-height: 18px;
  font-size: 14px;
}

.Personaldata {
  display: flex;
}
.personaldataimage {
  padding: 20px 10px 10px 10px;
  flex: 1;
}
.personone,
.personuid,
.personvip {
  padding: 5px 0px 5px 0px;
}
.personaldata {
  flex: 2;
}
.m-class {
  display: inline-block;
  margin-left: 5px;
  background-color: #fbd54e;
  color: #b72025;
  padding: 1px 5px;
  margin-right: 5px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 400;
}
.userVip {
  font-weight: bold; /* 加粗 */
  color: #f57914; /* 设置文本颜色，这里使用橙色 */
}
.userSvip {
  color: #ff5722; /* 设置文本颜色为橙色 */
}
.normal {
  /* 普通用户的样式 */
  color: rgb(121, 121, 121);
  /* 其他样式属性 */
}

.vip {
  /* 普通会员的样式 */
  color: #20bae9;
  /* 其他样式属性 */
}

.super-vip {
  /* 超级会员的样式 */
  color: #ff0000;
  /* 其他样式属性 */
}

.annual-vip {
  /* 年费会员的样式 */
  color: #ff5100;
  /* 其他样式属性 */
}

.annual-super-vip {
  /* 年费超级会员的样式 */
  color: #e22794;
  /* 其他样式属性 */
}
</style>

<style>
.el-dialog {
  width: 30%;
}

@media screen and (max-width: 600px) {
  /* 移动端样式 */
  .tmsg-c-item article header .i-name {
    font-size: 12px !important;
  }
  .tmsg-c-item article header img {
    width: 42px !important;
    height: 42px !important;
  }
  .el-dialog {
    width: 50%;
  }
}

.tmsg-delete-btn,
.tmsg-reply-btn {
  border: none;
  padding: 5px;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
  border-radius: 3px;
}

.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}

.tmsgBox {
  position: relative;
  background: #fff;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 5px;
}
.tmsg-respond h3 {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 8px;
}
.tmsg-respond h3 small {
  font-size: smaller;
  cursor: pointer;
}
.tmsg-respond textarea {
  background: #f4f6f7;
  height: 100px;
  margin-bottom: 10px;
}

/*用户输入表单*/
.tmsg-r-info {
  margin: 10px 0;
}
.tmsg-r-info input {
  height: 30px;
  border-radius: 4px;
  background: #f4f6f7;
}
.tmsg-r-info .info-submit {
  margin: 10px 0;
  text-align: center;
}
.tmsg-r-info .info-submit p,
.tmsg-commentshow h1 {
  /*background: #97dffd;*/
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
  /*transition: all .3s ease-in-out;*/
  height: 30px;
  line-height: 30px;
  text-align: center;
}
/*.tmsg-r-info .info-submit p:hover{
    background: #47456d;
}*/
/*评论列表*/
.tmsg-comments .tmsg-comments-tip {
  display: block;
  border-left: 2px solid #363d4c;
  padding: 0 10px;
  margin: 40px 0;
  font-size: 20px;
}
.tmsg-commentlist {
  margin-bottom: 20px;
}
.tmsg-commentlist-children {
  position: relative;
  margin-bottom: 20px;
  margin-left: 50px;
  padding: 0 20px 5px 20px;
  list-style: none;
  background: #f8f8f8;
  border-radius: 6px;
}
.tmsg-commentlist-children::before {
  position: absolute;
  left: 15px;
  top: -17px;
  border: 9px solid transparent;
  border-bottom: 10px solid #f8f8f8;
  content: "";
}
.tmsg-commentshow > .tmsg-commentlist {
  border-bottom: 1px solid #e5eaed;
}
.tmsg-c-item {
  border-top: 1px solid #e5eaed;
}
.tmsg-c-item article {
  margin: 20px 0;
}
.tmsg-c-item article header {
  margin-bottom: 10px;
}
.tmsg-c-item article header img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  float: left;
  transition: all 0.4s ease-in-out;
  -webkit-transition: all 0.4s ease-in-out;
  margin-right: 15px;
  object-fit: cover;
}

.tmsg-c-item article header .i-name {
  font-size: 0.9rem;
  margin: 5px 8px 7px 0;
  /* color: #444; */
  font-weight: bold;
  display: inline-block;
}
.tmsg-c-item article header .i-class {
  display: inline-block;
  margin-left: 10px;
  background: #dff0d8;
  color: #3c763d;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 400;
}
.tmsg-c-item article header .i-time {
  color: #aaa;
  font-size: 12px;
  margin-left: 65px;
}
.tmsg-c-item article section {
  margin-left: 80px;
}
.tmsg-c-item article section p img {
  vertical-align: middle;
}
.tmsg-c-item article section .tmsg-replay {
  margin: 10px 0;
  font-size: 12px;
  color: #64609e;
  cursor: pointer;
}
</style>
